package cn.edu.zzuli.nothinglink.mapper.provider;

import org.apache.ibatis.jdbc.SQL;

import java.util.Map;

public class StudentsProvider {

    public String findByInfo(Map<String, Object> info) {
        SQL sql = new SQL();
        sql.SELECT("stu_id, stu_name, stu_number, stu_username, stu_gender")
                .FROM("students");
        if (info.get("stuId") != null) {
            sql.WHERE("stu_id = #{stuId}");
        }
        if (info.get("stuName") != null) {
            sql.WHERE("stu_name = #{stuName}");
        }

        sql.WHERE("deleted = 0");

        return sql.toString();
    }

}
